#include <stdio.h>

int removeDuplicates(int *nums,int numsSize){
    int k=1;
    for(int i=1;i<numsSize;++i){
        if( nums[i] != nums[i-1] )
            nums[k++]=nums[i];
    }
    return k;
}

int main(){
    int a[]={0,1,2,2,2,3,4,5};
    int n=removeDuplicates(a,sizeof(a)/sizeof(int));
    for(int i=0;i<n;i++)
        printf("%d ",a[i]);
    return 0;
}
